<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Refreshes the cache entries for the cached files</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.wincache-ocache-meminfo.html">« wincache_ocache_meminfo</a></li>
      <li style="float: right;"><a href="function.wincache-rplist-fileinfo.html">wincache_rplist_fileinfo »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.wincache.html">WinCache 函数</a></li>
    <li>Refreshes the cache entries for the cached files</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.wincache-refresh-if-changed" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">wincache_refresh_if_changed</h1>
  <p class="verinfo">(PECL wincache &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">wincache_refresh_if_changed</span> &mdash; <span class="dc-title">
   Refreshes the cache entries for the cached files
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.wincache-refresh-if-changed-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>wincache_refresh_if_changed</strong></span>(<span class="methodparam"><span class="type">array</span> <code class="parameter">$files</code><span class="initializer"> = NULL</span></span>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   Refreshes the cache entries for the files, whose names were passed in the input argument. 
   If no argument is specified then refreshes all the entries in the cache.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.wincache-refresh-if-changed-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">files</code></dt>

     <dd>

      <p class="para">
       An array of file names for files that need to be refreshed. 
       An absolute or relative file paths can be used.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.wincache-refresh-if-changed-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>true</code></strong>， 或者在失败时返回 <strong><code>false</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.wincache-refresh-if-changed-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   WinCache performs regular checks on the cached files to 
   ensure that if any file has changed then the corresponding entry in the cache is 
   updated. By default this check is performed every 30 seconds. If, for example, 
   a PHP script updates another PHP script where the application&#039;s 
   configuration settings are stored, then it may happen that after the 
   configuration settings have been saved to a file, the application is still using 
   old settings for some time until the cache is refreshed. In those cases it may be 
   preferrable to refresh the cache right after the file has been changed. The 
   following example shows how this can be done.
   <div class="example" id="example-658">
    <p><strong>示例 #1 A <span class="function"><strong>wincache_refresh_if_changed()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;<br />$filename&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'C:\inetpub\wwwroot\config.php'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$handle&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #0000BB">$filename</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'w+'</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$handle&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">FALSE</span><span style="color: #007700">)&nbsp;die(</span><span style="color: #DD0000">'Failed&nbsp;to&nbsp;open&nbsp;file&nbsp;'</span><span style="color: #007700">.</span><span style="color: #0000BB">$filename</span><span style="color: #007700">.</span><span style="color: #DD0000">'&nbsp;for&nbsp;writing'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$handle</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'&lt;?php&nbsp;$setting=something;&nbsp;?&gt;'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$handle</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">wincache_refresh_if_changed</span><span style="color: #007700">(array(</span><span style="color: #0000BB">$filename</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


  <div class="refsect1 seealso" id="refsect1-function.wincache-refresh-if-changed-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.wincache-fcache-fileinfo.html" class="function" rel="rdfs-seeAlso">wincache_fcache_fileinfo()</a> - Retrieves information about files cached in the file cache</span></li>
    <li class="member"><span class="function"><a href="function.wincache-fcache-meminfo.html" class="function" rel="rdfs-seeAlso">wincache_fcache_meminfo()</a> - Retrieves information about file cache memory usage</span></li>
    <li class="member"><span class="function"><a href="function.wincache-ocache-fileinfo.html" class="function" rel="rdfs-seeAlso">wincache_ocache_fileinfo()</a> - Retrieves information about files cached in the opcode cache</span></li>
    <li class="member"><span class="function"><a href="function.wincache-ocache-meminfo.html" class="function" rel="rdfs-seeAlso">wincache_ocache_meminfo()</a> - Retrieves information about opcode cache memory usage</span></li>
    <li class="member"><span class="function"><a href="function.wincache-rplist-fileinfo.html" class="function" rel="rdfs-seeAlso">wincache_rplist_fileinfo()</a> - Retrieves information about resolve file path cache</span></li>
    <li class="member"><span class="function"><a href="function.wincache-rplist-meminfo.html" class="function" rel="rdfs-seeAlso">wincache_rplist_meminfo()</a> - Retrieves information about memory usage by the resolve file path cache</span></li>
    <li class="member"><span class="function"><a href="function.wincache-ucache-meminfo.html" class="function" rel="rdfs-seeAlso">wincache_ucache_meminfo()</a> - Retrieves information about user cache memory usage</span></li>
    <li class="member"><span class="function"><a href="function.wincache-ucache-info.html" class="function" rel="rdfs-seeAlso">wincache_ucache_info()</a> - Retrieves information about data stored in the user cache</span></li>
   </ul>
  </p>
 </div>

 
</div></div></div></body></html>